package oocl.ita.eordering.webService;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;

import oocl.ita.eordering.po.Food;
import oocl.ita.eordering.service.FoodService;
@Component
public class GetOrderStatusWS {
	private static Properties prop = new Properties();
	public int getOrderStatusWS(int oId) {// public void getMechantPass( MerchantService
									// mService) {
		Client client = Client.create();
		client.setReadTimeout(1000);
		try {
			prop.load(new FileInputStream(GetOrderStatusWS.class.getClassLoader().getResource("/../config/ws.properties").getPath()));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String url = prop.getProperty("startUrlforOrderStatus");
		WebResource wr = client.resource(url+oId);
		System.out.println(url);
		String cStatus = wr.accept(MediaType.APPLICATION_JSON_TYPE)// accept请求头
				.get(String.class);
		return Integer.parseInt(cStatus);
	}
}